function [ output_args ] = paraout(ofile)
%UNTITLED4 Summary of this function goes here
%   Detailed explanation goes here

 global filex filep
 global nspex ishape nthe nphim theu phiu
 global gx gy gz dx dy dz spinm axa aya aza niso wgt
 global pop arat  nnit npro axb ayb azb
 global gxt gyt gzt dxt dyt dzt spinmt axat ayat azat
 global popt aratt  nnitt nprot axbt aybt azbt nisot wgtt  theut  phiut
 global isaveh ilin iiso
 global flx fly flz flxt flyt flzt  bwidemax 
 global r1  r2  c1  c2 

 fmt2d = ' %12d %12d \n';
 fmt1e = '%.7E\n';
 fmt2e = ' %.7E %.7E\n';
 fmt3e = ' %.7E %.7E %.7E\n';
 fmt4e = ' %.7E %.7E %.7E %.7E\n';
 fmt5e = ' %.7E %.7E %.7E %.7E %.7E\n';
 ftm6ed= ' %.7E %.7E %.7E %.7E %12d %.7E\n';  %Because niso is an integer
 ftm5ed= ' %12d %12d %.7E %.7E %.7E\n';  %nnit and npro are integers
 fmt9e = ' %.7E %.7E %.7E %.7E %.7E %.7E %.7E %.7E %.7E\n';
 
 ofile='tst.txt';
 fid=fopen(ofile, 'wt');
 
 fprintf(fid, '$par$\n');
 fprintf(fid, fmt2d, nspex, ishape);
 fprintf(fid, fmt2d, nthe, nphim);
 iangle=0;
 if(nthe==1 && nphim==1) 
     iangle=1; 
    fprintf(fid, fmt2e, theu, phiu);
 end
 fprintf(fid, fmt5e, gx, gy, gz, dx, dy, dz);
 fprintf(fid, fmt6ed, spinm, axa, aya, aza, niso, wgt);  %niso is an integer
 if(niso==2) write(fid, fmt2e, pop, arat); end
 fprintf(fid, fmt5ed, nnit, npro, axb, ayb, azb);  %nnit and npro are integers
 if(ishape==3 || ishape==6) fprintf(fid, fmt3e, flx, fly, flz); end
 if (ishape==7) fprintf(fid, fmt1e, bwidemax); end
 if(nspex==2)
     if(iangle==1) fprintf(fid, fmt2e, theut, phiut); end
     fprintf(fid, fmt6e, gxt, gyt, gzt, dxt, dyt, dzt);
     fprintf(fid, fmt6ed, spinmt, axat, ayat, azat, nisot, wgtt);  %nisot is an integer
     if(nisot==2) fprintf(fid, fmt2e, popt, aratt); end
     fprintf(fid, fmt5ed, nnitt, nprot, axbt, aybt, azbt); %nnitt and nprot are integers
     if(ishape==3 || ishape==6) fprintf(fid, fmt3e, flxt, flyt, flzt); end
 end
 fprintf(fid, fmt1e, isaveh);
 if(isaveh==1)
     fprintf(fid, fmt2e, ilin, iiso);
 end
 fclose(fid);
 return 
end
 

